package com.keshan.service.impl;

import com.keshan.mapper.MessageMapper;
import com.keshan.pojo.Message;
import com.keshan.pojo.MessageExample;
import com.keshan.service.MessageServices;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author keshan
 * @date 2022/10/21 - 19:20
 */
@Service
public class MessageServicesImpl implements MessageServices {
    @Autowired
    MessageMapper messageMapper;
    @Override
    public int insertBySelectiveMessage(Message message) {
        return messageMapper.insertSelective(message);
    }

    @Override
    public List<Message> getMessageListByDeviceid(String deviceid) {
        MessageExample messageExample = new MessageExample();
        MessageExample.Criteria criteria = messageExample.createCriteria();
        criteria.andDeviceidEqualTo(deviceid);
        return messageMapper.selectByExample(messageExample);
    }
}
